Don't do remote checks on NULL files
authorРуслан Ижбулатов <lrn1986@gmail.com>
Thu, 4 Feb 2016 11:23:12 +0000 (11:23 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Thu, 4 Feb 2016 15:57:35 +0000 (15:57 +0000)
Calling _gtk_file_consider_as_remote() with a NULL argument
results in warnings being thrown.

Note that query->priv->location being NULL is a state that does
not seem to be invalid by itself.

This could happen if you do search-as-you-type in a filechooser,
which has a filter that does not match anything *and* the current
"place" selected is "Recent".

https://bugzilla.gnome.org/show_bug.cgi?id=761552

gtk/gtkfilechooserwidget.c
gtk/gtksearchenginesimple.c

index d1a2ed8b364f107e5da43a2d87e26343c2b1d779..c77a8b7b96a81f2d7d230e98cac802a4688391a6 100644 (file)
@@ -7340,7 +7340,8 @@ search_start_query (GtkFileChooserWidget *impl,
 
   _gtk_search_engine_start (priv->search_engine);
 
-  if (_gtk_file_consider_as_remote (gtk_query_get_location (priv->search_query)))
+  if (gtk_query_get_location (priv->search_query) &&
+      _gtk_file_consider_as_remote (gtk_query_get_location (priv->search_query)))
     gtk_widget_show (priv->remote_warning_bar);
 }
 
index b80af31b1f8ea1dea9bda6278b7dd46d5402a25b..6daf2f863106c80133891799a8af48fe71a97a2d 100644 (file)
@@ -92,7 +92,8 @@ static void
 queue_if_local (SearchThreadData *data,
                 GFile            *file)
 {
-  if (!_gtk_file_consider_as_remote (file) &&
+  if (file &&
+      !_gtk_file_consider_as_remote (file) &&
       !g_file_has_uri_scheme (file, "recent"))
     g_queue_push_tail (data->directories, g_object_ref (file));
 }